home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / ENET.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  4.2 KB  |  168 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ENET.h
  3.  
  4.      Contains:    Ethernet Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1990-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ENET__
  18. #define __ENET__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __OSUTILS__
  24. #include <OSUtils.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=mac68k
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49.  
  50. enum {
  51.     ENetSetGeneral                = 253,                            /*Set "general" mode*/
  52.     ENetGetInfo                    = 252,                            /*Get info*/
  53.     ENetRdCancel                = 251,                            /*Cancel read*/
  54.     ENetRead                    = 250,                            /*Read*/
  55.     ENetWrite                    = 249,                            /*Write*/
  56.     ENetDetachPH                = 248,                            /*Detach protocol handler*/
  57.     ENetAttachPH                = 247,                            /*Attach protocol handler*/
  58.     ENetAddMulti                = 246,                            /*Add a multicast address*/
  59.     ENetDelMulti                = 245                            /*Delete a multicast address*/
  60. };
  61.  
  62.  
  63. enum {
  64.     EAddrRType                    = FOUR_CHAR_CODE('eadr')        /*Alternate address resource type*/
  65. };
  66.  
  67. typedef struct EParamBlock                 EParamBlock;
  68. typedef EParamBlock *                    EParamBlkPtr;
  69. typedef CALLBACK_API( void , ENETCompletionProcPtr )(EParamBlkPtr thePBPtr);
  70. /*
  71.     WARNING: ENETCompletionProcPtr uses register based parameters under classic 68k
  72.              and cannot be written in a high-level language without 
  73.              the help of mixed mode or assembly glue.
  74. */
  75. typedef REGISTER_UPP_TYPE(ENETCompletionProcPtr)                 ENETCompletionUPP;
  76.  
  77. struct EParamBlock {
  78.     QElem *                            qLink;                        /*General EParams*/
  79.     short                             qType;                        /*queue type*/
  80.     short                             ioTrap;                        /*routine trap*/
  81.     Ptr                             ioCmdAddr;                    /*routine address*/
  82.     ENETCompletionUPP                 ioCompletion;                /*completion routine*/
  83.     OSErr                             ioResult;                    /*result code*/
  84.     StringPtr                         ioNamePtr;                    /*->filename*/
  85.     short                             ioVRefNum;                    /*volume reference or drive number*/
  86.     short                             ioRefNum;                    /*driver reference number*/
  87.     short                             csCode;                        /*Call command code*/
  88.     union {
  89.         struct {
  90.             short                             eProtType;            /*Ethernet protocol type*/
  91.             Ptr                             ePointer;            /*No support for PowerPC code*/
  92.             short                             eBuffSize;            /*buffer size*/
  93.             short                             eDataSize;            /*number of bytes read*/
  94.         }                                 EParms1;
  95.         struct {
  96.             Byte                             eMultiAddr[6];        /*Multicast Address*/
  97.         }                                 EParms2;
  98.     }                                 u;
  99. };
  100.  
  101. enum { uppENETCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  102. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  103.     #pragma parameter CallENETCompletionProc(__A1, __A0)
  104.     void CallENETCompletionProc(ENETCompletionUPP routine, EParamBlkPtr thePBPtr) = 0x4E91;
  105. #else
  106.     #define CallENETCompletionProc(userRoutine, thePBPtr)         CALL_ONE_PARAMETER_UPP((userRoutine), uppENETCompletionProcInfo, (thePBPtr))
  107. #endif
  108. #define NewENETCompletionProc(userRoutine)                         (ENETCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppENETCompletionProcInfo, GetCurrentArchitecture())
  109. EXTERN_API( OSErr )
  110. EWrite                            (EParamBlkPtr             thePBptr,
  111.                                  Boolean                 async);
  112.  
  113. EXTERN_API( OSErr )
  114. EAttachPH                        (EParamBlkPtr             thePBptr,
  115.                                  Boolean                 async);
  116.  
  117. EXTERN_API( OSErr )
  118. EDetachPH                        (EParamBlkPtr             thePBptr,
  119.                                  Boolean                 async);
  120.  
  121. EXTERN_API( OSErr )
  122. ERead                            (EParamBlkPtr             thePBptr,
  123.                                  Boolean                 async);
  124.  
  125. EXTERN_API( OSErr )
  126. ERdCancel                        (EParamBlkPtr             thePBptr,
  127.                                  Boolean                 async);
  128.  
  129. EXTERN_API( OSErr )
  130. EGetInfo                        (EParamBlkPtr             thePBptr,
  131.                                  Boolean                 async);
  132.  
  133. EXTERN_API( OSErr )
  134. ESetGeneral                        (EParamBlkPtr             thePBptr,
  135.                                  Boolean                 async);
  136.  
  137. EXTERN_API( OSErr )
  138. EAddMulti                        (EParamBlkPtr             thePBptr,
  139.                                  Boolean                 async);
  140.  
  141. EXTERN_API( OSErr )
  142. EDelMulti                        (EParamBlkPtr             thePBptr,
  143.                                  Boolean                 async);
  144.  
  145.  
  146.  
  147.  
  148. #if PRAGMA_STRUCT_ALIGN
  149.     #pragma options align=reset
  150. #elif PRAGMA_STRUCT_PACKPUSH
  151.     #pragma pack(pop)
  152. #elif PRAGMA_STRUCT_PACK
  153.     #pragma pack()
  154. #endif
  155.  
  156. #ifdef PRAGMA_IMPORT_OFF
  157. #pragma import off
  158. #elif PRAGMA_IMPORT
  159. #pragma import reset
  160. #endif
  161.  
  162. #ifdef __cplusplus
  163. }
  164. #endif
  165.  
  166. #endif /* __ENET__ */
  167.  
  168.